{template 'common/header'}
<div class="main">
	<ul class="nav nav-tabs">
		<li><a href="{php echo $this->createWebUrl('list');}">门店列表</a></li>
		<li class="active"><a href="{php echo $this->createWebUrl('post');}">{if empty($item)}添加{else}修改{/if}门店</a></li>
	</ul>
	<div class="panel panel-info">
		<div class="panel-heading">{if empty($item)}添加{else}修改{/if}门店</div>
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form" id="form1">
			<input type="hidden" name="id" value="{$item['id']}">
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">门店名称</label>
				<div class="col-sm-8">
					<input class="form-control" name="title" id="" type="text" value="{$item['title']}">
					&nbsp;&nbsp;请填写门店名称
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">宣传图</label>
				<div class="col-sm-8">
					{php echo tpl_form_field_image('thumb',$item['thumb'],'', $options);}
					&nbsp;&nbsp;宣传图上传 
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">简介</label>
				<div class="col-sm-8">
					<textarea name="content" class="form-control richtext" >{$item['content']}</textarea>
				</div>		
			</div>
			<script language='javascript'>
			require(['jquery', 'util'], function($, u){
				$(function(){
					u.editor($('.richtext')[0]);
				});
			});
			</script>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">电话</label>
				<div class="col-sm-8">
					<input class="form-control" name="phone" id="" type="text" value="{$item['phone']}">
					&nbsp;&nbsp;请填写门店电话号码
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">QQ</label>
				<div class="col-sm-8">
					<input class="form-control" name="qq" id="" type="text" value="{$item['qq']}">
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">地区</label>
				<div class="col-sm-8">
					{php $reside = array('province'=>$item['province'], 'city'=>$item['city'], 'district'=>$item['dist']);}
					{php echo tpl_form_field_district('reside',$reside)}
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">详细地址</label>
				<div class="col-sm-8">
					<input class="form-control" name="address" id="" type="text" value="{$item['address']}">
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">地图图标</label>
				<div class="col-sm-8">
					{php echo tpl_form_field_image('icon',$item['icon'],'', $options);}
					&nbsp;&nbsp;地图图标上传 尺寸25px*25px 
				</div>		
			</div>
			<div class="form-group">
				<label class="col-xs-13 col-sm-2 col-md-2 col-lg-2 control-label">坐标</label>
				<div class="col-sm-8">
					{php $baidumap = array('lng'=>$item['lng'],'lat'=>$item['lat']);}
					{php echo tpl_form_field_coordinate('baidumap',$baidumap);}
				</div>		
			</div>
			<div class="form-group">
				<div class="col-sm-8">
					<input type="submit" name="submit" value="确定" class="btn btn-primary">
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>		
			</div>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
	require(['jquery', 'util'], function($, u){
		$("#form1").submit(function(){
			if(!$(":text[name='title']").val()) {
				u.message('抱歉，门店名称为必填项，请返回修改！', '', 'error');
				return false;
			}
			if($(":text[name='phone']").val() == '') {
				u.message('抱歉，电话必填项，请返回修改！', '', 'error');
				return false;
			}
			if($(":text[name='address']").val() == '') {
				u.message('抱歉，地址为必填项，请返回上传！', '', 'error');
				return false;
			}
			if($(":text[name='baidumap[lng]']").val() == '') {
				u.message('抱歉，坐标为必选项，请返回修改！', '', 'error');
				return false;
			}
			return true;
		});
	});
</script>
{template 'common/footer'}